Ext.define('PJ.view.registrationmanagement.DeptTree', {
    extend: 'AM.default.DefaultTree',
    alias: ['widget.DeptTree'],
    
    initComponent: function(){
    	this.store = Ext.create('PJ.'+ prototype +'.registrationmanagement.DeptTree',{
    		isLoad:true
    	});
    	
		var treeStore = this.getStore();
		var u;
		if(this.tree.form.up('window').clickSource==1){
			u=treeStore.url2+"?depId="+this.tree.form.up('window').sponsorId;
		}else{
			u=treeStore.url;
		}
		treeStore.setProxy({
			type: gj_onlineLearning_constant.loadType,
			url: u,
		});
		
        this.callParent(arguments);
    },
		listeners: {
			//显示树的一级菜单
            load: function(treeStore, node, records, successful, eOpts){
                if (records != null && node.hasChildNodes()) {
                    this.expandNode(records[0]);
                    isExp = false;
                }
            },
			itemClick: function(){
				var me=this;
				var record=me.getSelectionModel().getSelection();
				me.deptId=record[0].data.id;
				me.deptName=record[0].data.text;
	            
			}
		}
});
